Add localonly domain option to libvirt-network#376
Conversation
f9ede62 to
633494e
Compare
MalloZup
left a comment
There was a problem hiding this comment.
https://github.com/dmacvicar/terraform-provider-libvirt/pull/288/files#diff-042e2374df248e4277a3506b065eb28aR512
in this patch we miss the resource.SET and (we lack on real test for this)
3862d25 to
10d86c4
Compare
|
Hopefully I sufficiently ripped off your test code :) It seems to work. |
4317ca2 to
7ede8e9
Compare
| return &networkDef, nil | ||
| } | ||
|
|
||
| func testAccCheckLibvirtNetworkLocalOnlyStatus(name string, LocalOnlyStatus bool) resource.TestCheckFunc { |
There was a problem hiding this comment.
small nitpick testAccCheckLibvirtNetworkLocalOnlyStatus should be called:
ModuleTest_ + Testname
TestAccCheckLibvirtNetwork_LocalOnlyStatus
I know that this not documented so you coud not know it but we are trying to move all the testnames in this direction.
So when we run Acceptance test we get more the debug context and more ordered output/results
| } | ||
| } | ||
|
|
||
| func testAccCheckLibvirtNetworkDNSForwarders(name string, expected []libvirtxml.NetworkDNSForwarder) resource.TestCheckFunc { |
There was a problem hiding this comment.
nitpick: testAccCheckLibvirtNetworkDNSForwarders -> TestAccCheckLibvirtNetwork_DNSForwarders
| resource.TestCheckResourceAttr("libvirt_network.test_net", "dns.0.forwarders.1.address", "10.10.0.67"), | ||
| resource.TestCheckResourceAttr("libvirt_network.test_net", "dns.0.forwarders.1.domain", "my.domain.com"), | ||
| resource.TestCheckResourceAttr("libvirt_network.test_net", "dns.0.forwarders.2.domain", "hello.com"), | ||
| testAccCheckLibvirtNetworkDNSForwarders("libvirt_network.test_net", []libvirtxml.NetworkDNSForwarder{ |
| } | ||
|
|
||
| func resourceLibvirtNetworkCreate(d *schema.ResourceData, meta interface{}) error { | ||
| dnsPrefix := "dns.0" |
There was a problem hiding this comment.
nitpick: i would enforce here this to be a const since will should never change
| } | ||
|
|
||
| func resourceLibvirtNetworkRead(d *schema.ResourceData, meta interface{}) error { | ||
| dnsPrefix := "dns.0" |
There was a problem hiding this comment.
afaik const is better here
MalloZup
left a comment
There was a problem hiding this comment.
looks good to me a part of short nitpicks but it is ok from my pov. thx
e4705df to
dc4a9a5
Compare
I make a new DNS a sectrion of network, more like the upstream xml. Inside that new DNS section I include forwarders, which were under the main object, so this is a breaking change. But one that aligns with the upstream xml and one which allows much easier future growth of DNS management. I add 'localOnly' which tells dnsmasq to own all of the domain in question. Instead of forwarding unknown names. This way you can point your local DNS at the libvirt DNS for the domain in question, and the domain in question will not forward unknown hosts back to your local DNS.
dc4a9a5 to
7651ee5
Compare
|
@dmacvicar feel free to have a look, to me looks good. |
PR dmacvicar#393 has introduced a new function name. ( merged). PR dmacvicar#376 was using the old name, which we merged after pr dmacvicar#393 and the review was done before merging dmacvicar#393. This commit just fix the name of function
This allows one to tell dnsmasq to own all of the domain in question.
Instead of forwarding unknown names. This way you can point your local
DNS at the libvirt DNS for the domain in question, and the domain in
question will not forward unknown hosts back to your local DNS.